package cn.bgs.service.impl;

import cn.bgs.mapper.AnnouncementMapper;
import cn.bgs.pojo.Announcement;
import cn.bgs.service.IAnnouncementService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * <p>
 * 公式公告表(社区活动表) 服务实现类
 * </p>
 *
 * @author cf
 * @since 2022-06-07
 */
@Service
public class AnnouncementServiceImpl extends ServiceImpl<AnnouncementMapper, Announcement> implements IAnnouncementService {
    @Autowired
    private AnnouncementMapper mapper;
    @Override
    public List<Announcement> findAll(@Param("id") Integer id,@Param("biaoti") String biaoti,@Param("lei") String lei) {
        return mapper.findAll(id,biaoti,lei);
    }

    @Autowired
    private AnnouncementMapper announcementMapper;
    @Override
    public List<Announcement> getAnnouncement(Integer id) {
        return announcementMapper.getAnnouncement(id);
    }
    @Override
    public Boolean deleteById(Integer id) {
        return mapper.deleteById1(id);
    }

    @Override
    public Boolean updateById(@Param("id") Integer id, @Param("huod") String huod, @Param("textarea") String textarea, @Param("marketName") String marketName,@Param("qu") Integer qu) {
        Boolean b =null;
        if (id!=null){
           b =  mapper.updateById(id,huod,textarea,marketName);
        }else {
            b = mapper.into(huod,textarea,marketName,qu);
        }
        return b;
    }

    @Override
    public List<Announcement> findById(@Param("id1")Integer id1, @Param("lei")String lei) {
        return mapper.findById(id1,lei);
    }
}
